Skip to content

Port skipif.inc to EXTENSIONS #7141

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 3 commits into from
Closed

Port skipif.inc to EXTENSIONS #7141

wants to merge 3 commits into from

Conversation

nikic
Copy link
Member

@nikic nikic commented Jun 11, 2021

In some cases this drops skipif.inc completely, in some cases only removes the extension_loaded check.

@nikic
Copy link
Member Author

nikic commented Jun 11, 2021

@cmb69 I see a test failure on Windows after these changes:

========DIFF========
001+ Notice: tempnam(): file created in the system's temporary directory in C:\projects\php-src\ext\ldap\tests\ldap_connect_ldap_conf.php on line 2
001- string(16) "example.com:3141"
002+ string(13) "localhost:389"
========DONE========
FAIL ldap_connect() - Connection using default host from openldap's ldap.conf [C:\projects\php-src\ext\ldap\tests\ldap_connect_ldap_conf.phpt] 

I fixed the temp dir issue but the behavior still looks wrong. Should this test just be skipped on Windows? I assume it didn't run previously.

@cmb69
Copy link
Member

cmb69 commented Jun 11, 2021

Wouldn't ext/ldap/tests/ldap_connect_ldap_conf.phpt also need require_once('skipifbindfailure.inc'); at the end of the SKIPIF section?

Of course, ideally we should set up an LDAP test environment on Windows, but I wouldn't know how.

@nikic
Copy link
Member Author

nikic commented Jun 11, 2021

I'm not completely sure, but I don't think so. If I understand correctly, ldap_bind() is the operation that actually "connects" in the classical sense, while this test only uses ldap_connect().

@cmb69
Copy link
Member

cmb69 commented Jun 11, 2021

I think ldap_get_option() also tries to bind. The docs say: "The actual connect happens with the next calls to ldap_* funcs, usually with ldap_bind()."

@nikic
Copy link
Member Author

nikic commented Jun 11, 2021

For this particular test, the purpose is to check that the LDAPCONF environment variable is respected. The diffs shows that the provided host/port is not used and the default is used instead. So my suspicion here would be that LDAPCONF is not supported on Windows, though I couldn't really find any information on that.

@cmb69
Copy link
Member

cmb69 commented Jun 11, 2021

LDAPCONF is generally supported on Windows, but putenv() has issues on Windows ZTS. Instead of using a temp file, we could write the config to a file in the test suite folder, and use --ENV--, but that doesn't support {PWD} (like --INI-- does), so the test would not be portable.

@cmb69
Copy link
Member

cmb69 commented Jun 11, 2021

Quick hack for AppVeyor to exclude all extensions from php.ini, but not to execute any tests for unsupported extensions:

 appveyor/build_task.bat |  2 +-
 appveyor/test_task.bat  | 11 ++++++++---
 2 files changed, 9 insertions(+), 4 deletions(-)

diff --git a/appveyor/build_task.bat b/appveyor/build_task.bat
index 93ed1bccf3..1a5d7113ec 100644
--- a/appveyor/build_task.bat
+++ b/appveyor/build_task.bat
@@ -62,7 +62,7 @@ if "%INTRINSICS%" neq "" set ADD_CONF=%ADD_CONF% --enable-native-intrinsics=%INT
 
 set EXT_EXCLUDE_FROM_TEST=snmp,oci8_12c,pdo_oci,pdo_firebird,ldap,imap
 rem the following exts are tested via --EXTENSIONS--; update as necessary
-set EXT_EXCLUDE_FROM_TEST=bz2,exif,fileinfo,ffi,ftp,gd,gmp,soap,sodium,sqlite3,tidy,%EXT_EXCLUDE_FROM_TEST%
+set EXT_EXCLUDE_FROM_TEST=bz2,curl,dba,enchant,exif,fileinfo,ffi,ftp,gd,gettext,gmp,intl,mbstring,mysqli,odbc,openssl,pdo_mysql,pdo_odbc,pdo_pgsql,pdo_sqlite,pgsql,shmop,soap,sockets,sodium,sqlite3,sysvshm,tidy,xsl,zend_test,%EXT_EXCLUDE_FROM_TEST%
 if "%OPCACHE%" equ "0" set EXT_EXCLUDE_FROM_TEST=%EXT_EXCLUDE_FROM_TEST%,opcache
 
 set CFLAGS=/W1 /WX
diff --git a/appveyor/test_task.bat b/appveyor/test_task.bat
index 87eee6de8b..47e2a52dbc 100644
--- a/appveyor/test_task.bat
+++ b/appveyor/test_task.bat
@@ -89,9 +89,14 @@ if not exist "%PHP_BUILD_CACHE_ENCHANT_DICT_DIR%\en_US.aff" (
 mkdir %LOCALAPPDATA%\enchant\hunspell
 copy %PHP_BUILD_CACHE_ENCHANT_DICT_DIR%\* %LOCALAPPDATA%\enchant\hunspell
 
-set TEST_PHPDBG_EXECUTABLE=%PHP_BUILD_OBJ_DIR%\Release
-if "%THREAD_SAFE%" equ "1" set TEST_PHPDBG_EXECUTABLE=%TEST_PHPDBG_EXECUTABLE%_TS
-set TEST_PHPDBG_EXECUTABLE=%TEST_PHPDBG_EXECUTABLE%\phpdbg.exe
+rem remove ext dlls for which tests are not supported
+set PHP_BUILD_DIR=%PHP_BUILD_OBJ_DIR%\Release
+if "%THREAD_SAFE%" equ "1" set PHP_BUILD_DIR=%PHP_BUILD_DIR%_TS
+for %%i in (imap ldap oci8_12c pdo_firebird pdo_oci snmp) do (
+	del %PHP_BUILD_DIR%\php_%%i.dll
+)
+
+set TEST_PHPDBG_EXECUTABLE=%PHP_BUILD_DIR%\phpdbg.exe
 
 mkdir c:\tests_tmp

A cleaner solution would be not to use the auto-generated php.ini at all, but to create it here (only a few entries are actually necessary). This would save the EXT_EXCLUDE_FROM_TEST fiddling.

@nikic
Copy link
Member Author

nikic commented Jun 14, 2021

LDAPCONF is generally supported on Windows, but putenv() has issues on Windows ZTS. Instead of using a temp file, we could write the config to a file in the test suite folder, and use --ENV--, but that doesn't support {PWD} (like --INI-- does), so the test would not be portable.

Thanks, I implemented that option in 7485682 and it worked. The rest of this change is merged in 849a34e.

A cleaner solution would be not to use the auto-generated php.ini at all, but to create it here (only a few entries are actually necessary). This would save the EXT_EXCLUDE_FROM_TEST fiddling.

That would be ideal. Which extensions still need to be explicitly enabled?

@nikic nikic closed this Jun 14, 2021
@cmb69
Copy link
Member

cmb69 commented Jun 14, 2021

That would be ideal. Which extensions still need to be explicitly enabled?

See PR #7150.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants